bitkeeper revision 1.1159.1.406 (41928524UPMcQawd73xQPamw2lNEYQ)
authorcl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Wed, 10 Nov 2004 21:16:20 +0000 (21:16 +0000)
committercl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Wed, 10 Nov 2004 21:16:20 +0000 (21:16 +0000)
Move timer from domain to exec_domain.

xen/common/schedule.c
xen/include/xen/sched.h

index 748a2263290d219018545655b3466b8e59887833..805d5c633a5c46639198f9bb3c5ee6e5c7ee0a92 100644 (file)
@@ -181,20 +181,17 @@ void sched_add_domain(struct exec_domain *ed)
     /* Must be unpaused by control software to start execution. */
     set_bit(EDF_CTRLPAUSE, &ed->ed_flags);
 
-    if (ed->eid == 0)
+    if ( d->id != IDLE_DOMAIN_ID )
     {
-        if ( d->id != IDLE_DOMAIN_ID )
-        {
-            /* Initialise the per-domain timer. */
-            init_ac_timer(&d->timer);
-            d->timer.cpu      = ed->processor;
-            d->timer.data     = (unsigned long)d;
-            d->timer.function = &dom_timer_fn;
-        }
-        else
-        {
-            schedule_data[ed->processor].idle = ed;
-        }
+        /* Initialise the per-domain timer. */
+        init_ac_timer(&ed->timer);
+        ed->timer.cpu      = ed->processor;
+        ed->timer.data     = (unsigned long)ed;
+        ed->timer.function = &dom_timer_fn;
+    }
+    else
+    {
+        schedule_data[ed->processor].idle = ed;
     }
 
     SCHED_OP(add_task, ed);
@@ -204,7 +201,10 @@ void sched_add_domain(struct exec_domain *ed)
 
 void sched_rem_domain(struct domain *d) 
 {
-    rem_ac_timer(&d->timer);
+    struct exec_domain *ed;
+
+    for_each_exec_domain(d, ed)
+        rem_ac_timer(&ed->timer);
     SCHED_OP(rem_task, d);
     TRACE_2D(TRC_SCHED_DOM_REM, d->id, d);
 }
@@ -311,7 +311,7 @@ long do_sched_op(unsigned long op)
 /* Per-domain one-shot-timer hypercall. */
 long do_set_timer_op(unsigned long timeout_hi, unsigned long timeout_lo)
 {
-    struct domain *p = current->domain;
+    struct exec_domain *p = current;
 
     rem_ac_timer(&p->timer);
     
@@ -321,7 +321,8 @@ long do_set_timer_op(unsigned long timeout_hi, unsigned long timeout_lo)
         add_ac_timer(&p->timer);
     }
 
-    TRACE_4D(TRC_SCHED_SET_TIMER, p->id, p, timeout_hi, timeout_lo);
+    TRACE_5D(TRC_SCHED_SET_TIMER, p->domain->id, p->eid, p, timeout_hi,
+             timeout_lo);
 
     return 0;
 }
@@ -515,10 +516,10 @@ static void t_timer_fn(unsigned long unused)
 /* Domain timer function, sends a virtual timer interrupt to domain */
 static void dom_timer_fn(unsigned long data)
 {
-    struct domain *p = (struct domain *)data;
-    struct exec_domain *ed = p->exec_domain[0];
+    struct exec_domain *ed = (struct exec_domain *)data;
+    struct domain *d = ed->domain;
     TRACE_0D(TRC_SCHED_DOM_TIMER_FN);
-    update_dom_time(p);
+    update_dom_time(d);
     send_guest_virq(ed, VIRQ_TIMER);
 }
 
index 63eafa4204843035269890e44417cbd055653270..01479cc031057b74638401a6efabb93e18cfd543 100644 (file)
@@ -92,6 +92,8 @@ struct exec_domain
 
     struct thread_struct thread;
 
+    struct ac_timer  timer;         /* one-shot timer for timeout values */
+
     s_time_t         lastschd;      /* time this domain was last scheduled */
     s_time_t         lastdeschd;    /* time this domain was last descheduled */
     s_time_t         cpu_time;      /* total CPU time received till now */
@@ -121,7 +123,6 @@ struct domain {
 
     /* Scheduling. */
     int              shutdown_code; /* code value from OS (if DF_SHUTDOWN). */
-    struct ac_timer  timer;         /* one-shot timer for timeout values */
     void            *sched_priv;    /* scheduler-specific data */
 
     struct domain *next_list, *next_hash;